/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package imageProcessing.classes;

import ProcesamientoImagenes.interfaces.BufferedImageMaker;
import java.awt.image.BufferedImage;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.imageio.ImageIO;

/**
 *
 * @author damfercer
 */
public class GeneralBufferedImageMaker implements BufferedImageMaker{

    @Override
    public BufferedImage getBufferedImageFromPath(String path) {
        BufferedImage image=null;
        try {
            image = ImageIO.read(new URL(path));
        } catch (IOException ex) {
            Logger.getLogger(GeneralBufferedImageMaker.class.getName()).log(Level.SEVERE, null, ex);
        }
        return image;
    }

    @Override
    public BufferedImage getBufferedImageFromUrl(URL url) {
        BufferedImage image=null;
        try {
            image = ImageIO.read(url);
        } catch (IOException ex) {
            Logger.getLogger(GeneralBufferedImageMaker.class.getName()).log(Level.SEVERE, null, ex);
        }
        return image;
    }

    @Override
    public BufferedImage getBufferedImageFromInputStream(InputStream is) {
        BufferedImage image=null;
        try {
            image = ImageIO.read(is);
        } catch (IOException ex) {
            Logger.getLogger(GeneralBufferedImageMaker.class.getName()).log(Level.SEVERE, null, ex);
        }
        return image;
    }
    
}
